<?php
 // Copyright (C) 2011 Cassian LUP <cassi.lup@gmail.com>
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License
 // as published by the Free Software Foundation; either version 2
 // of the License, or (at your option) any later version.

        //SANITIZE ALL ESCAPES
        $sanitize_all_escapes=true;

        //STOP FAKE REGISTER GLOBALS
        $fake_register_globals=false;

        //continue session
        session_start();

	//landing page definition -- where to go if something goes wrong
        $landingpage = "index.php?site=".$_SESSION['site_id'];	
	//

	// kick out if patient not authenticated
	if ( isset($_SESSION['pid']) && isset($_SESSION['patient_portal_onsite']) ) {
  		$pid = $_SESSION['pid'];
	}
	else {
                session_destroy();
  		header('Location: '.$landingpage.'&w');
                exit;
	}
	//

	$ignoreAuth=true;
	require_once('../interface/globals.php');
	require_once("$srcdir/patient.inc");
	require_once("$srcdir/options.inc.php");
	require_once("$srcdir/acl.inc");
	require_once("../interface/patient_file/history/history.inc.php");

	?>
	
	<script type="text/javascript">
	$(document).ready(function(){
		tabbify();
	});
	</script>

<?php
  $tmp = getPatientData($pid, "squad");
  if ($tmp['squad'] && ! acl_check('squads', $tmp['squad'])){
   $thisauth = 0;
  }

 $result = getHistoryData($pid);
 if (!is_array($result)) {
  newHistoryData($pid);
  $result = getHistoryData($pid);
 }
?>

<div style='float:none; margin-top: 10px; margin-right:20px'>
    <h2 style="border-bottom: 1px solid rgb(204, 204, 204); padding-bottom: 10px;">ANTECEDENTES</h2>
	<table>
    <tr>
        <td>
            <!-- Demographics -->
            <div id="HIS">
                <ul class="tabNav">
                   <?php display_layout_tabs('HIS', $result, $result2); ?>
                </ul>
                <div class="tabContainer">
                   <?php display_layout_tabs_data('HIS', $result, $result2); ?>
                </div>
            </div>
        </td>
    </tr>
    </table>
</div>
	
	
	
	<!--
	/*
		<?php 
		if(sqlNumRows($res)>0)
		{
			echo "<h2>ALERGIAS <span style='float: right; background-color: rgb(228, 228, 228); border-radius: 5px 5px 5px 5px; border-right: 1px solid rgb(204, 204, 204); border-width: 2px 1px 1px; border-style: solid; border-color: -moz-use-text-color rgb(204, 204, 204) rgb(204, 204, 204); -moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none; -moz-border-left-colors: none; border-image: none; padding: 0px 10px;'> ".sqlNumRows($res)." </span></h2>";
		?>
			<ul>
			<?php
				while ($row = sqlFetchArray($res)) 
				{
				?>
				<li>
					<p>
						<span class="title"><?php echo "<td>".htmlspecialchars( $row['title'],ENT_NOQUOTES);?></span><br/>
						<span class="desc">
							<?php
							echo htmlspecialchars( $row['date'],ENT_NOQUOTES)."</br>";
							?>
						</span>
					</p>
				</li>
				<?php
				}
			echo "</ul>";
		}
		else
		{
			echo "<h2>ALERGIAS <span style='float: right; background-color: rgb(228, 228, 228); border-radius: 5px 5px 5px 5px; border-right: 1px solid rgb(204, 204, 204); border-width: 2px 1px 1px; border-style: solid; border-color: -moz-use-text-color rgb(204, 204, 204) rgb(204, 204, 204); -moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none; -moz-border-left-colors: none; border-image: none; padding: 0px 10px;'> ".sqlNumRows($res)." </span></h2>";
			
			echo "<ul><li><p>".htmlspecialchars( xl("No Results"),ENT_NOQUOTES)."</p></li></ul>";
		}
		
		?>
		*/
		-->
	
